
package maquinaVirtual;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author Miguel Angel Diaz Calvo
 * @author David Martin Moreno
 */
public class Ventana extends javax.swing.JFrame {
    
	private static final long serialVersionUID = 1L;
	
	/** Declaracion de variables */
    private javax.swing.JButton jButton1;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;

	
	/** Crea un nuevo formulario Ventana */
    public Ventana() {
        initComponents();
        // Centrar ventana en pantalla
        try {
            Dimension ventana = Toolkit.getDefaultToolkit().getScreenSize();
            int alto = ventana.height;
            int ancho = ventana.width;
            this.setLocation(ancho/2-this.getWidth()/2, alto/2-this.getHeight()/2);
        } catch (Exception e) {
            this.setLocation(0,0);
        }
        setResizable(false);
    }
    
    public Ventana(String mensaje) {
        initComponents();
        jTextArea1.setText(mensaje);
        // Centrar ventana en pantalla
        try {
            Dimension ventana = Toolkit.getDefaultToolkit().getScreenSize();
            int alto = ventana.height;
            int ancho = ventana.width;
            this.setLocation(ancho/2-this.getWidth()/2, alto/2-this.getHeight()/2);
        } catch (Exception e) {
            this.setLocation(0,0);
        }
        setResizable(false);
    }
    
    private void initComponents() {
    	setTitle("Manual Maquina-P");
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        jDesktopPane1.setBackground(new java.awt.Color(204, 255, 153));
        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setEditable(false);
        jScrollPane1.setViewportView(jTextArea1);

        jScrollPane1.setBounds(0, 2, 400, 500);
        jDesktopPane1.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText("Cerrar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton1.setBounds(150, 530, 90, 23);
        jDesktopPane1.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE)
        );
        
        pack();
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        dispose();
    }
    
    /**
     * @param args los argumentos de la linea de comandos
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Ventana().setVisible(true);
            }
        });
    }
    
}
